package com.leyou.item.inter.api;

import com.leyou.common.bean.PageResult;
import com.leyou.common.bean.Result;
import com.leyou.common.bean.ServerConstant;
import com.leyou.item.inter.dto.BrandPageDTO;
import com.leyou.item.inter.dto.BrandUpdateDTO;
import com.leyou.item.inter.fallback.BrandServiceFallbackFactory;
import com.leyou.item.inter.pojo.Brand;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author zqq
 * @ClassName IBrandService
 * @Description
 * @date 2020/3/7-16:21
 */
@Component
@FeignClient(value = ServerConstant.ITEM_SERVICE_ID, fallbackFactory = BrandServiceFallbackFactory.class)
public interface IBrandService {

    @RequestMapping(value = "/brand/page", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<PageResult<Brand>> queryBrandsByPage(@RequestBody BrandPageDTO dto);

    @RequestMapping(value = "/brand/cid/{cid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<List<Brand>> queryBrandsByCid(@PathVariable("cid") Long cid);

    @RequestMapping(value = "/brand/bid/{bid}", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE)
    Result<Brand> queryBrandById(@PathVariable("bid")Long bid);
}
